package svl;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import beans.Cliente;

/**
 * Servlet implementation class RegistroSVL
 */
public class RegistroSVL extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession sesion = request.getSession();
		
		Cliente cliente = (Cliente) sesion.getAttribute("cliente");
		if (cliente == null) {
			cliente = new Cliente();
			sesion.setAttribute("cliente", cliente);
		}
		
		String nombre = request.getParameter("nombre");
		cliente.setNombre(nombre);
		String apellido = request.getParameter("apellido");
		cliente.setApellido(apellido);
		
	    String address = "/WEB-INF/jsp/registro.jsp";
	    RequestDispatcher dispatcher = request.getRequestDispatcher(address);
	    dispatcher.forward(request, response);
	}

}
